{%- macro form_field(field) -%}
    <div class="form-field">
        {% if field.type == 'BooleanField' %}
            <p class="boolean">{{ field(**kwargs) }}{{ field.label }}</p>
        {% else %}
            {{ field.label }}{% if field.flags.required %} <abbr class="required" title="{{ _('required') }}">*</abbr>{% endif %}
            <p>{{ field(**kwargs) }}</p>
        {% endif %}
        {% if field.description %}
            <p class="description">{{ field.description }}</p>
        {% endif %}
        {% if field.errors %}
        <ul class="error-list">
            {% for error in field.errors %}
            <li>{{ error }}</li>
            {% endfor %}
        </ul>
        {% endif %}
    </div>
{%- endmacro -%}

{%- macro system_messages(messages) -%}
    {%- if messages -%}
        <div id="tp-msg-box" class="tp-msg-box">
            {%- for msg in messages -%}
            <div class="tp-msg tp-msg-{{ msg.level }}"{% if msg.life %} life="{{ msg.life }}"{% endif %}>
                {% if msg.title %}<div class="tp-msg-hd">{{ msg.title }}</div>{% endif %}
                <div class="tp-msg-bd">{{ msg.body }}</div>
                <div class="tp-msg-close">&times;</div>
            </div>
            {%- endfor -%}
        </div>
    {%- endif -%}
{%- endmacro -%}
